package com.cn.zengzeng.spbzengzeng.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.data.redis.listener.RedisMessageListenerContainer;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @Author: ZhangZengZeng
 * @Date: 2023/3/9 16:52
 */
@RestController
@Slf4j
@RequestMapping("/redis")
public class RedisPushController {
    @Resource
    StringRedisTemplate stringRedisTemplate;

    @Resource
    RedisMessageListenerContainer container;

    @GetMapping("/push")
    public void sendCatMessage() {
        stringRedisTemplate.convertAndSend("cat", "猫");
    }

}
